﻿--use PolePosition
GO

IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'up_VendorVisitXMissionStructure_SelectIdList')
	DROP PROCEDURE up_VendorVisitXMissionStructure_SelectIdList
GO

CREATE PROCEDURE up_VendorVisitXMissionStructure_SelectIdList
	 @Vendor_ProjectFK int
	,@SearchByType varchar(50) = null
	,@SearchByText varchar(50) = null
	
AS

DECLARE @IdList varchar(MAX)
SET @IdList = ''


/* Temporary chnage that we pull pole ids rather than structure ids*/
SELECT 
	 @IdList = @IdList + CONVERT(varchar, [Vendor_Visit_XMissionStructures_PoleId]) + ','
FROM 
	v_tb_Vendor_Visit_XMissionStructures_Poles Pole
INNER JOIN v_tb_Vendor_Visit_XMissionStructures Structures
	ON Pole.Vendor_Visit_XMissionStructureFK = Structures.Vendor_Visit_XMissionStructureId
WHERE
	Structures.Vendor_ProjectFK = @Vendor_ProjectFK
	
	
--SELECT 
--	 @IdList = @IdList + CONVERT(varchar, [Vendor_Visit_XMissionStructureId]) + ','
--FROM v_tb_Vendor_Visit_XMissionStructures
--WHERE
--	Vendor_ProjectFK = @Vendor_ProjectFK

SELECT @IdList

GO
